<template>
<div class="content">
    <mt-header fixed title="资产详情">
              <div slot="left">
    <mt-button icon="back" @click.native="goback()">返回</mt-button>
              </div>
    </mt-header>
    <mt-cell title="设备名称" :value="result.devicename" v-show="result.devicename"></mt-cell>
    <mt-cell title="创建时间" :value="result.createtime" v-show="result.createtime"></mt-cell>
    <mt-cell title="所属资产" :value="result.assetname" v-show="result.assetname"></mt-cell>
    <mt-cell title="所属品类" :value="result.categoryname" v-show="result.categoryname"></mt-cell>
    <mt-cell title="所在位置" :value="result.fixlocation" v-show="result.fixlocation"></mt-cell>
    <mt-cell title="设备图片" v-show="result.devicekurl">
      <img :src="result.devicekurl"/>
    </mt-cell>
    </div>
</template>
<script>
export default {
  data () {
    return {
      result: {}
    }
  },
  created () {
    this.getdevicedetail()
  },
  computed: {
    siteid () {
      return this.$store.state.user.sitelist[0].siteid
    }
  },
  methods: {
    async getdevicedetail () {
      const res = await this.$store.dispatch('assetdetails', {
        assetid: 'b716422c-c489-4645-b86c-e31a1f92e47b',
        siteid: this.siteid
      })
      if (res.status === '0') {
        this.result = res.context
        console.log(res)
      }
    },
    goback () {
      this.$router.go(-1)
    }
  }

}
</script>
<style lang="less" scoped>
.content{
    padding-top: 40px;
}

</style>
